<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>学生信息管理系统</title>
</head>
<body>
    <?php
        include_once "HeaderNav.html";  //引入头部
    ?>
    <h2>详细信息</h2>
    <?php
    // print_r($_GET);
    if(!isset($_GET['StudentID'])){
        header("Location:Students.php");
        exit();
    }
    $StudentID=$_GET['StudentID'];
    //1.使用mysqli对象建立数据库连接
    require "Conn.php";
    //2.执行SQL语句
    $sql = "select * from student where StudentID='$StudentID'";
    $result = $db->query($sql);  //执行查询,返回的是一个资源类型的结果集
    //3.处理结果集
    if($result){
        $rows = $result->fetch_assoc();
        echo "<table class='tb'>";
        echo "<tr><th>学号</th><td>".$rows["StudentID"]."</td></tr>";
        echo "<tr><th>姓名</th><td>".$rows["StudentName"]."</td></tr>";
        echo "<tr><th>密码</th><td>".$rows["Password"]."</td></tr>";
        echo "<tr><th>班级号</th><td>".$rows["ClassNo"]."</td></tr>";
        echo "<tr><th>爱好</th><td>".$rows["Hobby"]."</td></tr>";
        echo "<tr><th>性别</th><td>".$rows["Sex"]."</td></tr>";
        echo "<tr><th>手机</th><td>".$rows["Mobile"]."</td></tr>";
        echo "<tr><th>邮箱</th><td>".$rows["Email"]."</td></tr>";
        echo "<tr><th>照片</th><td><img width='100' src='upload/".$rows["Photo"]."' /></td></tr>";
        echo "</table>";
    }
    $result->close();
    //4.断开连接
    $db->close();
    ?>
    <?php
        include_once "Footer.html";  //引入脚部
    ?>
</body>
</html>